const express = require('express')
const fs = require('fs')
const path = require('path')

const app = express()


app.get('/list', function (request, response) {
  // console.log(request);
  // 如果访问 'http://localhost:8848/list'
  let list = ['西瓜', '梨子', '樱桃', '苹果']
  // response.send  要改成 response.jsonp 配合前端的jsonp方式
  response.jsonp(JSON.stringify(list, null, 2))
})

app.listen(8848, function (error) {
  if (!error) {
    console.log('服务器已开启，通过http://localhost:8848/ 访问');
    return
  }


})
// console.log(app);
